import {carPostData,carGetGood} from 'network/car/emit.js'
export default {
  addCount(state,payload){
    payload.count++
  },
  addGoods(state,payload){
    payload.count=1
    payload.pay=false
    if(payload.price!=null&&isNaN(parseInt(payload.price.charAt(0)))){
      payload.price=Number(payload.price.slice(1))
    }
    state.goodsList.push(payload)
    console.log("list",state.goodsList);

  },
  setGoodPayReverse(state,payload){
    let good= state.goodsList.find(item=>{
      return item.id===payload.id
    })
    console.log("pay",good.pay);
    good.pay=!good.pay
  },
  setGoodsPayReverse(state,payload){
    state.goodsList.map(item=>{
      item.pay=!payload
    })
  },
  initUser(state,payload){
    state.user=payload
  }
}
